﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'FN' AND name = 'ufn_UPDMS_Get_Setting_Value')
	BEGIN
		DROP Function ufn_UPDMS_Get_Setting_Value
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : ufn_UPDMS_Get_Setting_Value
**	Desc : 설정코드로 설정값을 조회한다.
**	Test Exec Query : select dbo.ufn_UPDMS_Get_Setting_Value ('CRD_Opt_03')
**	Called by : 전체
**	Program ID : 전체
**	Auth : 송시명
**	Date : 2008-07-11
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE FUNCTION [dbo].[ufn_UPDMS_Get_Setting_Value]
(
@ls_cd nvarchar(20)
)
RETURNS nvarchar(200)
AS

BEGIN
    DECLARE @rtn nvarchar(200)
    SET @rtn = ''

    SELECT @rtn = Setting_Value
      FROM (
           SELECT TOP 1 Setting_Value
             FROM UPDMS_CFG_SETTING_MGT WITH(NOLOCK)
            WHERE Setting_Cd = @ls_cd
              AND Use_Yn = 'Y'
           ) rslt
  
    RETURN LTRIM(RTRIM(@rtn))
  
END 